<form action="<?php echo site_url('/ajax/aj_add_baobei.php');?>" method="post" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
<div class="pageContent">
    <div class="pageFormContent" layoutH="57">
        <div class="unit">
            <label style="width: 60px">宝贝品牌：</label>
            <input name="orgLookup.brand_id" type="hidden"/>
            <input type="text" class="textInput" name="orgLookup.brand_name" size="25" readonly=""/>
            <a class="btnLook" target="dialog" href="<?php echo site_url('brand.php?a=lookup&rel=add_baobei');?>" lookupGroup="orgLookup">选择所属品牌</a>
            <span class="inputInfo">点击选择所属品牌</span>
        </div>
        <div class="unit">
            <label style="width: 60px">加入主题：</label>
            <input name="orgLookup.theme_id" type="hidden"/>
            <input type="text" class="textInput" name="orgLookup.theme_name" size="25" readonly=""/>
            <a class="btnLook" target="dialog" href="<?php echo site_url('theme.php?a=lookup&rel=add_baobei');?>" lookupGroup="orgLookup">选择加入主题</a>
            <span class="inputInfo">点击选择加入主题</span>
        </div>
        <div class="unit">
            <label style="width: 710px">宝贝所属：<?php $from_www = get_Baobei_url_domain($url); echo $from_www; ?></label>
        </div>
        <div class="unit">
            <label style="width: 710px">店铺名称：<?php if($from_www =='taobao'){ echo gbk2utf8($html->find("a.hCard", 0)->title);}elseif($from_www =='tmall'){ echo gbk2utf8($html->find("h3.shop-title a", 0)->plaintext); } ?>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                <a target="_blank"
                   href="http://www.taobao.com/webww/ww.php?ver=3&touid=<?php echo gbk2utf8($html->find("a.hCard", 0)->plaintext); ?>&siteid=cntaobao&status=1&charset=utf-8"
                   style="padding-top: 20px">
                    <img style="vertical-align:middle"
                         border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=<?php echo gbk2utf8($html->find("a.hCard", 0)->plaintext); ?>&site=cntaobao&s=1&charset=utf-8"
                         alt="点这里给我发消息" />
                </a>
            </label>
        </div>
        <div class="unit">
            <input name="url" value="<?php echo $url; ?>" type="hidden"/>
            <label style="width: 710px">宝贝地址：<?php echo $url; ?></label>
        </div>
        <div class="unit">
            <label style="width: 710px">宝贝编号：<?php echo get_TmallAndTaobao_url_id($url,'id'); ?></label>
        </div>
        <div class="unit">
            <label style="width: 60px">宝贝类型：</label>
            <input name="orgLookup.baobei_type_id" type="hidden"/>
            <input type="text" class="textInput" name="orgLookup.baobei_type_name" size="25" readonly=""/>
            <a class="btnLook" target="dialog" width="350" height="600" href="<?php echo site_url('baobei.php?a=typetree&rel=add_baobei');?>" lookupGroup="orgLookup">选择分类</a>
            <span class="inputInfo">点击选择宝贝类别</span>
        </div>
        <div class="unit">
            <label style="width: 710px">宝贝名称：<?php $title = gbk2utf8($html->find("div.tb-detail-hd h3", 0)->plaintext); echo $title; ?></label>
        </div>
        <div class="unit">
            <label style="width: 710px">宝贝价格：￥<?php echo $html->find('strong[id=J_StrPrice]', 0)->plaintext; ?></label>
        </div>
        <div class="unit">
            <label style="width: 60px">宝贝标签：</label>
            <input type="text" name="tags" value="" class="required" size="60">
            <span class="inputInfo">4<标签长度<8字符，多个以";"隔开，最多10个标签</span>
        </div>
        <div class="unit">
            <!--宝贝图片-->
            <span  id="J_GoodsPubD">
             <label>宝贝图片：</label><br><br>
             <div class="form-row clearfix">
                 <div class="goods-gallery">
                     <div class="gallery-bd">
                         <div class="items">

                             <ul>
                                 <?php
                                 $img_str = '';
                                 // Extract images
                                 foreach ( $html ->find( '#J_UlThumb img' )  as   $key => $element )   {

                                     $src_300 = str_replace('40x40','310x310',$element ->src);

                                     $img_str .= $key.',';

                                     echo   '<li class="selected"><a href="javascript:void(0);"><img src="'.$src_300.'"></a><i></i></li>' ;
                                 }
                                 ?>
                             </ul>
                             <input name="img_url" value="<?php echo substr($img_str,0,-1); ?>" type="hidden"/>
                         </div>
                     </div>
                 </div>
             </div>
            </span>
            <!--/宝贝图片-->
        </div>
        <style type="text/css">

        .checkbox{vertical-align:middle; margin-top:0;}

        </style>
        <div class="unit">
            <label style="width: 60px">加入喜欢：</label>
            <input type="checkbox" name="islike" value="1"> 喜欢宝贝可勾选，将自动保存至我喜欢的列表
        </div>
    </div>
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">确认</button>
                    </div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button class="close" type="button" >关闭</button>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
</form>
<script type="text/javascript">
    (function ($) {
        $("div.items li").bind("click", function () {
            var check_selected = $(this).attr("class");
            var msgarr = new Array();
            var curr_img;
            if (check_selected == 'selected') {
                curr_img = $(this).index();
                $(this).removeClass();
            } else {
                $(this).attr("class", "selected");
            }
            $("div.items li").each(function () {
                var check_selected = $(this).attr("class");
                if (check_selected == 'selected') {
                    var t = $(this).index();
                    msgarr.push(t);
                }
            });
            //alert(msgarr);
            if (msgarr == null || msgarr == '') {
                $(this).attr("class", "selected");
                $('input[name=img_url]').val(curr_img);
                //alert('至少选择一张宝贝图片！');
                alertMsg.error('至少选择一张宝贝图片！');
                return false;
            } else {
                $('input[name=img_url]').val(msgarr);
            }
        })
    })(jQuery);
    //请求分词地址
    $(document).ready(function(){
        $.post('<?php echo site_url("/ajax/aj_get_title_fenci.php");?>',{'title':'<?php echo $title; ?>','do_fork':true,'do_unit':true,'t': Math.random()}, function(data){
             if (data.retCode == 1090){
                 //alert(data.words);
                 $('input[name=tags]').val(data.words);
             }
        }, 'json');
    });
</script>
<?php
    $html->clear();
?>